/*
 * @Description: 档案分类表格组件
 * @Author: Rfan
 * @Date: 2022-05-31 15:25:56
 * @LastEditTime: 2022-09-08 14:31:07
 */

import { useMemo, useState } from 'react';
import classNames from 'classnames/bind';
import { useArchiveClassifyContext } from '../contexts/ArchiveClassifyContext';
import ClassifyVer from './ClassifyVer';
import ClassifyDetail from './ClassifyDetail';

import styles from '../styles/list.module.scss';

const cx = classNames.bind(styles);

const PageContent = () => {
  const { selectFond, setSelectAT, setSelectVer } = useArchiveClassifyContext();
  const [query, setQuery] = useState({});

  const handleChange = ({ atId, atItem, verId, verItem }: any) => {
    setSelectAT(atItem);
    setSelectVer(verId);
    setQuery({
      archiveTypeId: atId,
      cVersion: verId
    });
  };

  return (
    <div className={cx('sort-container')}>
      {useMemo(
        () => (
          // <ATLevelNav activeFond={selectFond?.id} onChange={handleChange} />
          <ClassifyVer activeFond={selectFond?.id} onChange={handleChange} />
        ),
        [selectFond]
      )}
      <div className={cx('pane-wrap')}>
        <ClassifyDetail data={query} />
      </div>
    </div>
  );
};

export default PageContent;
